import { useContext } from 'react'

import { View } from '@tarojs/components'

import { Button, Checkbox } from '@antmjs/vantui'

import { LoginAgreeRadioProps } from './interface'
import { LoginContext } from '../../Context'

const LoginAgreeRadio = ({ className }: LoginAgreeRadioProps) => {
	const { agree, toggleAgree } = useContext(LoginContext)

	return (
		<View className={className}>
			<Checkbox value={agree} onChange={toggleAgree}>
				登录即表示您已阅读并同意
			</Checkbox>
			<Button plain type='info' style={{ margin: 'unset', padding: 'unset' }}>
				《用户协议》
			</Button>
		</View>
	)
}
export default LoginAgreeRadio
